package com.atguigu.customerdemo.mapper;

import com.atguigu.customerdemo.bean.Customer;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
@DS("mysql0926")
public interface CustomerMapper extends BaseMapper<Customer> {
//public interface CustomerMapper{

    //利用Mybatis通过注解的方式查询数据
    @DS("mysql1109")
    @Select("select * from customer where name = #{name}")
    public Customer getCustomerByName(@Param("name") String name);

    //利用Mybatis通过注解的方式写入数据
    @Insert("insert into customer(name,age) values (#{name}, #{age} )")
    public void saveCustomerByNameWithAge(@Param("name") String name, @Param("age") String age);

}
